package com.dao.impl;

import com.Bean.Fddate;

import com.Bean.RoomListTwo;

import com.dao.StatisticsTwoDao;
import com.util.JdbcUtil;

import java.sql.SQLException;
import java.util.List;

public class StatisticsDaoTwolmpl implements StatisticsTwoDao {

    public List<RoomListTwo> queryDatatwo(RoomListTwo roomListTwo, Fddate fddate) throws IllegalAccessException, SQLException, InstantiationException {
        String sql="select intime,lsum,lcash,deposit,sname,lsum+lcash total ,IF(deposit=2,lcash,0) allreturn ,lsum+lcash-IF(deposit=2,lcash,0) netReceipts " +
                "from room_list,payment_term " +
                "where room_list.sid=payment_term.sid";

        if(fddate.getLastDay()!=null){
            sql+=" and intime BETWEEN  '"+fddate.getFristDay()+"'  and  '"+ fddate.getLastDay()+"'";
            System.out.println(sql);
        }
        sql+=" ORDER BY intime";
        return JdbcUtil.queryData(sql,RoomListTwo.class);
    }

    @Override
    public int insert(RoomListTwo roomListTwo) throws SQLException {
        return 0;
    }

    @Override
    public List<RoomListTwo> queryData(RoomListTwo roomListTwo) throws IllegalAccessException, SQLException, InstantiationException {
        return null;
    }

    @Override
    public int update(RoomListTwo roomListTwo) throws SQLException {
        return 0;
    }

    @Override
    public int deleteById(Object id) throws SQLException {
        return 0;
    }
}
